/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.javahispano.nettools.cliente.Grafico;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import net.javahispano.nettols.comunicaciones.Objeto;
import net.javahispano.nettools.cliente.EjecutaComandos;
import net.javahispano.nettools.cliente.Informable;
import net.javahispano.nettools.cliente.NuestraExeption;

/**
 *
 * @author Usuario
 */
public class HiloVideo extends Thread implements Informable
{
    int estado;
     private EjecutaComandos ejecutoDeComandos;
    int direccion_video;
    JDialog     panelImagen;
    HiloVideo(EjecutaComandos ejecuto,int direccion){
    ejecutoDeComandos=ejecuto;
    direccion_video=direccion;
    estado=1;
    }



    @Override
   public void run()
   {
      // Aquí el código pesado que tarda mucho
while(estado==1)
    {
    estado=1;
            try {
                System.out.println("----[CLIENTE][MostrarImagen2] Bucle... Llamando a recibirImagenServidor()...");
               // ListaConsola.get(tab).setConsola2("Imagen recibidaaaaaa");
                ejecutoDeComandos.recibirImagenServidor(direccion_video);
                }
            catch (NuestraExeption ex)
                {
                System.out.println("ERROR>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
                Logger.getLogger(FrameCliente.class.getName()).log(Level.SEVERE, null, ex);
                }

            try {
                this.sleep(1500);
            } catch (InterruptedException ex) {
                Logger.getLogger(HiloVideo.class.getName()).log(Level.SEVERE, null, ex);
            }



                /*  if (panelImagen != null) {
                iIcon1 =   new ImageIcon("c:/capturo12.jpg");
                img1   =   iIcon1.getImage();
                //img2   =   img1.getScaledInstance(800, 1280,  java.awt.Image.SCALE_SMOOTH);
                if (tipo_tam==0){ //tamaño normal
                panelImagen.setSize(new Dimension(500, 500));
                img2   =   img1.getScaledInstance(600, 600,  java.awt.Image.SCALE_SMOOTH);
                }
                else{
                System.out.println("[SIZE]-------->>>>>>pintamos Imagen grande");
                Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
                panelImagen.setSize(d);
                img2   =   img1.getScaledInstance(d.width-40,d.height-80,  java.awt.Image.SCALE_SMOOTH);
                //Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
                //img2   =   img1.getScaledInstance(d.width-40,d.height-40,  java.awt.Image.SCALE_SMOOTH);
                }
                iIcon2 =   new ImageIcon(img2);
                etiqueta.setIcon(iIcon2);
                etiqueta.repaint();
                // panel5.repaint();
                // panelImagen.repaint();
                }
                 */
          
  /*  if (panelImagen != null) {

        iIcon1 =   new ImageIcon("c:/capturo12.jpg");
        img1   =   iIcon1.getImage();
        //img2   =   img1.getScaledInstance(800, 1280,  java.awt.Image.SCALE_SMOOTH);

        if (tipo_tam==0){ //tamaño normal
          panelImagen.setSize(new Dimension(500, 500));
         img2   =   img1.getScaledInstance(600, 600,  java.awt.Image.SCALE_SMOOTH);
        }
         else{
                    System.out.println("[SIZE]-------->>>>>>pintamos Imagen grande");
                    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
                  panelImagen.setSize(d);
                  img2   =   img1.getScaledInstance(d.width-40,d.height-80,  java.awt.Image.SCALE_SMOOTH);

            //Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
            //img2   =   img1.getScaledInstance(d.width-40,d.height-40,  java.awt.Image.SCALE_SMOOTH);
        }
        iIcon2 =   new ImageIcon(img2);
        etiqueta.setIcon(iIcon2);

        etiqueta.repaint();
       // panel5.repaint();
       // panelImagen.repaint();
    }
*/

//    try {
//          System.out.println("----[CLIENTE][MostrarImagen2] Bucle... SLEEPING...");
//                Thread.sleep(3000); //Tarea que consume diez segundos.
//        }
//        catch (InterruptedException ex)
//            {
//            Logger.getLogger(FrameCliente.class.getName()).log(Level.SEVERE, null, ex);
//            }

        System.out.println("----[CLIENTE][MostrarImagen2] Bucle... Fin");
    

   }

   
};
 public void detenElHilo()
   {
      estado=0;
   }

    public void mensageListarProcesos(String ListaDirectorios) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageActualizarListarProcesos(String ListaDirectorios) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageVideo(String NombreCaptura) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageServicios(String ServiciosActivos) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageInformacionEquipo(String informacionEquipo) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void clearShell2() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageReconstruirArbol(String SubdirectoriosArbol) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageInformacionArbol(String datosArbol) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageInformacion(String texto) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageError(String texto) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void informaSobreElProgreso(int progreso) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public boolean isConnected() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void StatusConex(String status) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void StatusDesc(String desc) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void StatusDescConsola(int desc) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Objeto recibeMensaje() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mensageInformacionConsolaVideo(String texto) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}